Embodiments of the present invention relate generally to structured documents, and more particularly to techniques for reducing the size of style sheets to be sent with structured documents via electronic mail by removing certain information from the style sheets.
The content of pages on the World Wide Web is often represented in Hypertext Markup Language (“HTML”) format, which provides formatting commands that are embedded in the content to specify structural aspects of the content, such as section and heading tags that can be used to designate particular text as headings, character formatting tags to specify font sizes and designate text as bold, italic, underlined, image tags to display images, reference tags to create links to other content, and so on. When a web page is to be displayed, these formatting commands are used by an application program such as a web browser to render the HTML and generate the appearance of the web page on a particular display device. The web browser translates the formatting tags to appropriate font styles and sizes, paragraph spacing and formatting, image positioning, link formats (e.g., underlined blue text), and the like, to be applied to the content when displaying the web page on the display device. The details of the particular formatting and positioning of the content in the displayed text, such as the particular font sizes, colors, paragraph formatting, indentation, and the like, can be supplied by the browser using default style rules for formatting and rendering the tags. However, the author or provider of the web page may wish have finer control over the appearance of the content on the web page. The Cascading Style Sheets standard provides a language in which different style rules for the formatting and rendering of tags can be specified and applied to HTML documents.
The Cascading Style Sheets (“CSS”) language enables styles such as fonts, colors, spacing, and the like for a web page to be named and specified separately from the HTML documents that contain the structure and content of the web page. The HTML document can refer to the style names instead of using specific values for style elements such as colors, font sizes, margins, and the like. The styles specified in a language such as CSS are referred to herein as style rules. Style rules can be specified for a particular HTML document by including them inline in the HTML document, or by including a particular HTML tag in the document that refers to an “external” style sheet. The external style sheet is ordinarily a file that contains style rules specified in a style sheet language such as CSS. The style rules can be, for example, name-value pairs that provide values for particular named style attributes of an associated HTML tag in a syntax such as <tag>{attribute name: value}. An example style rule is as follows:                h1 {color: blue}        
This style rule specifies that text in h1 (i.e., heading level 1) tags in the HTML document is to be rendered in the color blue in documents that refer to the style rule. The “h1” portion is a referred to herein as a “selector.” In this example, the h1 selector represents an h1 element in the document tree. The term “selector” refers to the web browser's use of the selector to “select” elements in a web page that match the selector when the web page is being rendered.
External style sheets can be stored, for example, in a file on the web server, to reduce the size of each web page that is sent from the web server to the browser. Since style sheets represent detailed information about the appearance and configuration of a user interface, including “skinning” information, and are represented in a text format, a web framework that provides many different component types may have numerous style sheet rules, numbering in the hundreds or thousands. The external style sheet feature supported by web browsers allows the browser to download the style sheet information once, instead of downloading the style sheet with every web page that uses style rules from the style sheet. However, in one embodiment, when a web page is sent in an e-mail message, the style sheet is included in the page, and external style sheets are not used, because some e-mail client application programs do not support external style sheets. An e-mail generator may not want to use external style sheets for other reasons as well. For example, HTML e-mail readers do not ordinarily have caches, so each time the e-mail is read, the external style sheet would be fetched from a public location, in which case there would be no bandwidth savings when using the external style sheet. As another example, the e-mail messages would then depend on access to the CSS file at an external site. A recipient of the e-mail may save the e-mail and read it months later, at which time the version of the CSS file used for the email would need to be publicly available. Further, the e-mail recipient would have difficulty reading the e-mail without Internet access, since no styling would be available.
HTML tag types such as the paragraph tag <p> can be “styled” by specifying style rules in a style sheet. Furthermore, the CSS language provides for specification of style rules at different levels of granularity, e.g., for all headings of a particular type, or for a specific class of headings of a particular type, or for a single instance of a heading tag, as well as combining multiple style sheets, resolving conflicts between style rules in multiple style sheets, placing style rules in the HTML document as attributes of the elements to which they apply, and so on.